<%= render 'spree/admin/shared/areas_tabs' %>

<% admin_breadcrumb(Spree.t(:settings)) %>
<% admin_breadcrumb(Spree.t('admin.tab.areas')) %>
<% admin_breadcrumb(plural_resource_name(Spree::Zone)) %>


<% content_for :page_actions do %>
  <% if can?(:create, Spree::Zone) %>
    <li>
      <%= button_link_to Spree.t(:new_zone), new_object_url, :id => 'admin_new_zone_link' %>
    </li>
  <% end %>
<% end %>

<%= paginate @zones, theme: "solidus_admin" %>

<% if @zones.any? %>
  <table class="index" id='listing_zones' data-hook>
    <colgroup>
      <col style="width: 30%" />
      <col style="width: 40%" />
      <col style="width: 15%" />
      <col style="width: 15%" />
    </colgroup>
    <thead>
      <tr data-hook="zones_header">
        <th><%= sort_link @search,:name, Spree::Zone.human_attribute_name(:name), :title => 'zones_order_by_name_title' %></th>
        <th>
          <%= sort_link @search,:description, Spree::Zone.human_attribute_name(:description), {}, {:title => 'zones_order_by_description_title'} %>
        </th>
        <th><%= Spree.t(:default_tax) %></th>
        <th class="actions"></th>
      </tr>
    </thead>
    <tbody>
      <% @zones.each do |zone| %>
        <tr id="<%= spree_dom_id zone %>" data-hook="zones_row" class="<%= cycle('odd', 'even')%>">
          <td class="align-center"><%= zone.name %></td>
          <td><%= zone.description %></td>
          <td class="align-center"><%= zone.default_tax? ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
          <td class="actions">
            <% if can?(:update, zone) %>
              <%= link_to_edit zone, :no_text => true %>
            <% end %>
            <% if can?(:destroy, zone) %>
              <%= link_to_delete zone, :no_text => true %>
            <% end %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <div class="col-xs-9 no-objects-found">
    <%= render 'spree/admin/shared/no_objects_found',
                 resource: Spree::Zone,
                 new_resource_url: new_object_url %>
  </div>
<% end %>

<%= paginate @zones, theme: "solidus_admin" %>
